<style scoped>
    .logo-img {
        width: 65%;
        height: 1080px;
    }
    .logo-img img{
       width:100%;
       height: 100%;
    }
    .login{
        text-align: center;
        width: 30%;
        margin-left: 70px;
        padding-top: 167px;
    }
    .login h1{
        font-size: 40px;
        color: #0066ff;
        font-weight: 900;
        margin: 0;
        height: 50px;
        margin-bottom: 66px;

    }
    .loginForm .el-input{
        border-radius: 10px;
        opacity: 1;
        background: #F5F5F5;
        width: 465px !important;
        height: 40px !important;
        border: 0px;
        font-size: 20px;
        outline: none;
        margin-top:40px ;
    }
    .loginButton{
        border-radius: 10px;
        opacity: 1;
        background: #E5E5E5;
        width: 465px;
        height: 70px;
        outline: none;
        border: 0px;
        font-size: 20px;
    }
    .feature{
        display: flex;
        justify-content: space-between;
        margin-top: 10px;   
        margin-bottom:30px ;
        padding: 0 35px;
    }
    .feature span{
        font-family: Source Han Sans;
        font-size: 14px;
        font-weight: normal;
        line-height: normal;
        letter-spacing: 0em;
        font-variation-settings: "opsz" auto;
        color: #2567FF;
    }
    .el-input{
        padding: 0 !important;
        width: 465px !important;
    }
 
</style>
<template>
    <div>
        <div class="container" style="display: flex;">
            <div class="logo-img">
                <img src="../../public/img/icons/2.png" alt="">
            </div>
            <div class="login">
                <div class="loginLogo">
                    <h1>yotpo.</h1>
                </div>
                <div class="loginForm">
                  <el-form action="" v-model="form">
                    <el-input type="text" placeholder="请输入账号" style="padding-left:40px " v-model="form.name" ></el-input>
                    <el-input type="text" placeholder="请输入密码" style="padding-left:40px " v-model="form.password"></el-input>
                  </el-form>
                    <div class="feature">
                        <span>找回密码</span>
                        <span>立即注册</span>
                    </div>
                    <button class="loginButton" @click="logins">
                        登录
                    </button>
                </div>
            </div>
        </div>
    </div>
</template>···              
<script>
    import {login} from '@/request/api/all'
    // import axios from 'axios'
    // import {post} from "@/request/http"

    export default {
        data(){
            return{
                form:{
                    name:'',
                    password:''
                }
            }
        },
    methods: {
    async logins() {
      const loginData = {
        account: 'admin',
        password: this.form.password
      };
      try {
        const response = await login(loginData);

        const token = response.data.data.token;
        console.log('登录成功，token:', token);
        
        // 将token存储在localStorage或Vuex中
        localStorage.setItem('token', token);
        // 登录成功后跳转页面
        this.$router.push('/home');
      } catch (error) {
        console.error('登录失败:', error);
      }
    },
   
  },
 
};
</script>